home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
arexx
/
modeler
/
dinner.lwm
< prev
next >
Wrap
Text File
|
1993-12-13
|
7KB
|
199 lines
/* Dinner Haiku Generator
from "Using ARexx on the Amiga" by Sullivan and Zamara
Adapted By Arnie
Encrufted by Robert
Sun May 24 12:45:53 1993
*/
signal on error
signal on syntax
call InitVocab()
call random(,,time('s'))
call addlib "LWModelerARexx.port", 0
Continue=1
do while Continue
Continue= GetDinner()
end
say 'Exiting...'
exit
/* GetDinner
Generate and return a single Haiku poem which tells us where to eat(in Topeka).
*/
GetDinner:
/* Select a template, parse it into 3 lines, and clear output buffer. */
t = random(1,num_templates)
parse var tem.t line.1 '+' line.2 '+' line.3
out. = ''
/* Process template lines one at a time. */
do i=1 to 3
/* Keep going till template line exhausted. */
do while length(line.i) > 0
parse var line.i cmd 3 qual 4 line.i
c = left(cmd, 1)
ucmd = upper(cmd)
if v.ucmd ~= "" then do
w = word(v.ucmd, random(1, words(v.ucmd)))
if datatype(c, 'u') then
w = upper(left(w, 1))substr(w, 2)
upper c
if c='V' & qual='@' then
w = add_ing(w)
else if c='N' & qual='s' then
w = pluralize(w)
else
line.i = qual || line.i
end
else if c='/' then do
parse value cmd || qual || line.i with '/' list '/' line.i
w = word(list, random(1, words(list)))
end
else
parse value cmd || qual || line.i with w 2 line.i
out.i = out.i || w
end
end
out.1=translate(out.1,' ','_')
out.2=translate(out.2,' ','_')
out.3=translate(out.3,' ','_')
say
say out.1 /* Redirect rx output to file */
say out.2 /* To capture Haikus to file */
say out.3 /* i.e. RX >>S:Haiku.Log Haiku.lwm */
say
return notify(2,'!'out.1, '!'out.2, '!'out.3,'@Bad choice? Try again!')
InitVocab:
v. = ""
/* Restaurants, two syllables */
v.j2 = "Annie's Chili's Winsteads the_Pad Denny's Vista the_Mall Mama's Tia's Arby's"
v.j2 = v.j2 "Tony's Subway Robert's Wendy's Luby's Dilley's Aboud's Byrd's_Nest Casa"
v.j2 = v.j2 "Grover's Hardee's Kobe Reema's Rosa's Shoney's Schlotzsky's Great_Wall"
/* Restaurants, three syllables */
v.j3 = "Evergreen Steak_&_Ale Bennigans Paisano's Pizza_Chef KFC McDonald's"
v.j3 = v.j3 "Burger_King McFarland's Giorgio's Don's_Steakhouse Applebee's"
v.j3 = v.j3 "Por'e_Richard's Red_Lobster Taco_Bell Village_Inn Horizons"
/*
In case any of you out there are reading through this program, the above two
sets of variables represents all of the restaurants open in Topeka, KS as of
5/24/93, and we just got the Denny's. My advice to you if you are planning to
visit Topeka is, first of all, don't and if you can't avoid it, then bring all
of the food that you will need with you.
*/
/* Dead Restaurants, two syllables */
v.d2 = "Blue_Moon Thu_Lang Victor's"
/* nouns, one syllables */
v.n1 = "dirt lead glass rocks mud rags mice rats cloth wire SPAM bones dust sand dung"
v.n1 = v.n1 "hair grass caulk logs wood Gak shoes"
/* nouns, two syllables */
v.n2 = "gerbil budgie parrot squirrel concrete badger muskrat baboon gravel pigeon"
v.n2 = v.n2 "lumber dingo dry_rot spackle Drano Windex Clorox polish"
/* food, two syllables */
v.f2 = "souffle salad sandwich surprise stirfry flambe pasta cobbler"
/* food verbs, one syllable */
v.e1 = "walk eat drive die sink croak stop crawl bite morph spit frag fade crave"
v.e1 = v.e1 "cut rent burn shop chomp pay drink eat snore writhe split"
/* food verbs, two syllables */
v.e2 = "explode refuse argue decline accept endure reboot scatter"
v.e2 = v.e2 "rebel retire despair wonder argue argue argue grumble"
v.e2 = v.e2 "comply render shiver flatline guru argue"
/* food adjectives, two syllables */
v.c2 = "empty fallen dismal crufty rabid smiling dying brain_dead "
v.c2 = v.c2 "sickened stricken clueless hopeless angry flattened helpless puking"
/* food line 1 */
v.b1 = "Are_we_hungry_yet? Let's_go_eat_food_now! Let's_argue_for_food!"
v.b1 = v.b1 "Must_we_eat_so_soon? Dinner_time_again? Let's_go_get_poisoned!"
v.b1 = v.b1 "Who_here_is_hungry? It's_that_time_again! We_want_some_good_food!"
/* food line 2, 4 syllables */
v.b4 = "You_are_doomed_to We're_hungry_for Everyone_loves We'll_have_fun_at"
v.b4 = v.b4 "Snarf_and_barf_at There's_fresh_food_at Free_dessert_at"
/* food line 2, 5 syllables */
v.b5 = "Your_death_awaits_at Instead_of_food_try There's_free_Rolaids_at"
v.b5 = v.b5 "We_love_the_food_at No_one's_been_killed_at Let's_all_go_to"
V.b5 = v.b5 "Brave_NewTekkers_try 2_for_1_sale_at"
/* food line 3 */
v.b6 = "Best_food_in_the_world! Who_could_ask_for_more? Topeka's_finest!"
v.b6 = v.b6 "Mmmm,_a_tasty_treat! My_favorite_death. We'll_even_have_seconds."
v.b6 = v.b6 "Delicious_food___-_NOT! Call_the_ambulance! Quick!_Run_for_your_lives."
v.b6 = v.b6 "It's_bleedin'_demised! Bring_the_stomach_pumps."
/* Dinner Haiku templates
The special tokens in the templates are:
a1,n2 etc. Part of speech, replaced randomly from corresponding list
A1,N2 etc. Same, but with initial capital
+ Converted to linefeed
@ After verb, specifies conversion to `ing' (gerund) form
s After noun, specifies conversion to plural form
/wordlist.../ Replaced by a word picked randomly from the list
All other symbols in the templates are taken literally.
*/
tem. = ""
tem.1 = "b1 +b4 j3. +C2, we e2."
tem.2 = "b1 +b5 j2. +C2, we e2."
tem.3 = "b1 +j2 is rarely /fatal toxic nasty deadly lethal/! +C2, we e2."
tem.4 = "b1 +b4 j3. +b6"
tem.5 = "b1 +b5 j2. +b6"
tem.6 = "b1 +j2 is rarely /fatal toxic nasty deadly lethal/! +C2, we e2."
tem.7 = "b1 +b5 j2. +b6"
tem.8 = "b1 +b4 j3. +b6"
tem.9 = "Lets eat at d2. +Yes! A damn fine restaurant. +/Ack! Doh! Oops!/ Out of business."
tem.10 = "b1 +b5 j2. +I'd as soon eat n1! "
tem.11 = "b1 +b4 j3. +I'd rather eat n1!"
tem.12 = "Let's eat at j2! +We'll have their n2 f2. +I'd as soon eat n1!"
tem.13 = "Let's try j3! +We'll have their n2 f2. +I'd as soon eat n1!"
tem.14 = "Let's eat at j2! +We'll have their n2 f2. +C2, we e2."
tem.15 = "Let's try j3! +We'll have their n2 f2. +C2, we e2."
tem.16 = "Let's eat at j2! +We'll have their n2 f2. +b6"
tem.17 = "Let's try j3! +We'll have their n2 f2. +b6"
tem.18 = "Unbelievably bad +for reasons you can't +even begin to imagine."
do i=1 while tem.i ~= ""
end
num_templates = i - 1
return
syntax:
error:
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
exit